//
//  MuytAppDelegate.h
//  Muyt
//
//  Created by murnork on 7/12/10.
//  Copyright 2010 cocomputing.com. All rights reserved.
//

#import <Cocoa/Cocoa.h>

@class ASIHTTPRequest;

@interface MuytAppDelegate : NSObject <NSApplicationDelegate> {
    NSWindow *window;
	NSComboBox *urlField;
	NSButton *startButton;
	NSProgressIndicator *downloadProgressIndicator;
	NSTextField *filenameLabel;
	
	NSString *downloadCount;
	NSMutableDictionary *downloadCountDict;
	NSString *imagePageContent;
	NSString *originalURL;
	
	NSUInteger retryCount;
	
	ASIHTTPRequest *getImagePageRequest;
	ASIHTTPRequest *getImageFileRequest;
}

@property (assign) IBOutlet NSWindow *window;
@property (nonatomic, retain) IBOutlet NSComboBox *urlField;
@property (nonatomic, retain) IBOutlet NSButton *startButton;
@property (nonatomic, retain) IBOutlet NSProgressIndicator *downloadProgressIndicator;
@property (nonatomic, retain) IBOutlet NSTextField *filenameLabel;
@property (nonatomic, retain) NSString *downloadCount;
@property (nonatomic, retain) NSString *imagePageContent;
@property (nonatomic, retain) NSString *originalURL;
@property (nonatomic, retain) NSMutableDictionary *downloadCountDict;

- (IBAction)startDownloadImage:(id)sender;
- (float) titleBarHeight;
- (void)downloadImage;
- (BOOL)haveDuplicateImageWithFileName:(NSString *)imageFileName inPath:(NSString *)imageMainPath;
- (NSString *)downloadDestinationWithFileName:(NSString *)filename inPath:(NSString *)mainPath;
- (NSString *)imageURLByParsingImagePageContent;
- (void)getImageFileFromURL:(NSURL *)imageURL;

@end
